home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Misc / Names < prev    next >
Encoding:
Text File  |  1999-03-04  |  1.3 KB  |  61 lines  |  [TEXT/ToyS]

  1. property kasConsanants : "BCDFGHJKLMNPQRSTVWXYZ"
  2. property kasVowels : "AEIOUY"
  3.  
  4. property kasLocation : {-1, -1} -- Start location of 0,0 centers the window initially
  5.  
  6. global gasInfo
  7.  
  8.  
  9. on run
  10.     -- Create an info window (use empty title have title bar on left)
  11.     set gasInfo to display info titled ¬
  12.         "Name 3rd" message ¬
  13.         "KEANU" located at kasLocation ¬
  14.         using font ¬
  15.         "Chicago" using size "36"
  16.     -- Default is line 1
  17. end run
  18.  
  19.  
  20. on quit
  21.     -- Close our windows
  22.     display info gasInfo with disposal
  23.     continue quit
  24. end quit
  25.  
  26.  
  27. on idle
  28.     -- Preserve window location in kasLocation if it is moved
  29.     set newLoc to screen location of ¬
  30.         (display info gasInfo message GenName())
  31.     
  32.     if (newLoc is not kasLocation) then set kasLocation to newLoc
  33.     
  34.     return random number from 1 to 10
  35. end idle
  36.  
  37.  
  38. on GenName()
  39.     set a to random number from 1 to 21
  40.     set b to random number from 1 to 6
  41.     set c to random number from 1 to 6
  42.     set d to random number from 1 to 21
  43.     set e to random number from 1 to 6
  44.     
  45.     set a to character a of kasConsanants
  46.     set b to character b of kasVowels
  47.     set c to character c of kasVowels
  48.     set d to character d of kasConsanants
  49.     set e to character e of kasVowels
  50.     
  51.     set choice to random number from 1 to 3
  52.     
  53.     if choice is 1 then ¬
  54.         return a & b & c & d & e
  55.     
  56.     if choice is 2 then ¬
  57.         return a & e & d & b & c
  58.     
  59.     return e & d & c & b & a
  60. end GenName
  61.